<!DOCTYPE html>
<html lang="zh-cn">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Bootstrap 101 Template</title>


  <!-- 新 Bootstrap 核心 CSS 文件 -->
  <link href="/css/bootstrap-3.2.0-dist/css/bootstrap.min.css" rel="stylesheet" media="screen"/>
  <link href="/css/bootstrap-3.2.0-dist/css/bootstrap-theme.min.css" rel="stylesheet" media="screen"/>


  <!--[if lt IE 9]>
  <script src="http://www.19mm.com/asset/bootstrap-3.2.0-dist/js/html5shiv.min.js"></script>
  <script src="http://www.19mm.com/asset/bootstrap-3.2.0-dist/js/respond.js"></script>
  <![endif]-->
</head>
<body>
<div class="container">
  <div id="tosubmit">
    <input type="text" id="title" name="title" class="form-control" placeholder="请输入文章标题" style="border-radius: 0px;padding: 20px;color:#000000">
    <br>
    <textarea><%=@obj.gcontents%> </textarea>
  </div>
  <div>
    <button id="bt">提交</button>
  </div>
</div>


<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="http://www.19mm.com/asset/jquery.min.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="http://www.19mm.com/asset/bootstrap-3.2.0-dist/js/bootstrap.min.js"></script>

<!--<script src="//tinymce.cachefly.net/4.1/tinymce.min.js"></script>-->
<script src="/js/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        tinymce.init({selector: 'textarea',
		 plugins: ["image"]
	    });
        $("#title").val("<%=@obj.title%>");
        $("#bt").click(function () {
//            alert($("#title").val());
//            alert(tinymce.activeEditor.getContent());
            $.ajax({
                type: "POST",
                dataType: "json",//返回json格式的数据
                url: "./edit",
                data:{title:$("#title").val(),gcontent:tinymce.activeEditor.getContent(),id:<%=@obj.id%>},
                success: function (data) {
//                    console.log(data['id']);
//                    console.log(data['title']);
                    alert("成功编辑文章，id号为"+data['id']);
                    $("#title").val("");

                    tinymce.activeEditor.setContent("");
                },
                async: false
            });
        });
    });
</script>
</body>
</html>